<?
##########################################################################
#		DOCUMENTATION
##########################################################################
# Class that extends the rootclass. This module will provide the methods
# needed to render the category page.
#
# © LiberLab group, 2011
##########################################################################

require_once("base/baseCatTop.php");

class Renderer extends BaseCatTop{
	public function __construct() {
		parent::__construct("category");
	}
	
	public function getViewesAndBox(){
		require_once("dataStructure/category.php");
		$categoryClass = new Category();
		$views = $categoryClass->getBooks(true, false, "views", true, $this->selected, $this->startId, $this->limit);
		$topViewedBox = $this->messages["topViewedBoxWithoutCat"];
		return array("views" => $views, "topViewedBox" => $topViewedBox);
	}

	public function pageExists($views){
		if (!isset($views[0]->category)){
			$this->pageFile = "404";
		}else{
			$categoryName = $views[0]->category;
			$this->tagHash["category"] = ucfirst($categoryName);
			$this->delRegex = "<a[^>]*?>\s*?(" . ucfirst($categoryName) . ")\s*?<\/a>";
		}
	}

	public function __destruct() {
		parent::__destruct();
	}
};

?>
